package com.wtwd.device.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.wtwd.device.model.entity.DeviceSleepRecord;
import com.wtwd.device.model.entity.DeviceSleepRecordInfo;
import com.wtwd.device.model.vo.DeviceSleepRecordVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * <p>
 * Mapper 接口
 * </p>
 *
 * @author mjy
 * @since 2024-05-31
 */
@Mapper
public interface AppDeviceSleepRecordMapper extends BaseMapper<DeviceSleepRecord> {

    /**
     * 设备按天插入或者更新
     *
     * @param deviceSleepRecord
     * @return
     */
    boolean insertOrUpdate(DeviceSleepRecord deviceSleepRecord);

    DeviceSleepRecordVo getDayDeviceSleepByTime(@Param("deviceId") Long deviceId, @Param("time") String time);

    List<DeviceSleepRecordVo> getDaysDeviceSleep(@Param("deviceId") Long deviceId, @Param("startTime") String startTime, @Param("endTime") String endTime);

    DeviceSleepRecord getLastDeviceSleepByDeviceId(@Param("deviceId") Long deviceId);

    int bathInsertOrUpdate(@Param("list") List<DeviceSleepRecord> deviceSleepRecords);
}
